package com.cal.utms.entity;

import java.io.Serializable;

import javax.persistence.*;

import com.cal.utms.logAudit.AuditLogInt;
import com.cal.utms.util.ValueConvert;

import java.math.BigDecimal;
import java.util.Date;

/**
 * The persistent class for the payment database table.
 * 
 */
@Entity
@Table(name = "payment")
@NamedQuery(name = "Payment.findAll", query = "SELECT p FROM Payment p")
public class Payment implements Serializable, AuditLogInt {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	private BigDecimal amount;

	@Column(name = "BANK_ACCOUNT")
	private String bankAccount;

	@Column(name = "BANK_NAME")
	private String bankName;

	@Temporal(TemporalType.DATE)
	@Column(name = "CHEQUE_DATE")
	private Date chequeDate;

	@Column(name = "CHEQUE_NO")
	private String chequeNo;

	@Temporal(TemporalType.DATE)
	@Column(name = "CONF_DATE")
	private Date confDate;

	@Column(name = "CONF_USER_ID")
	private int confUserId;

	@Column(name = "CUSTOMER_ID")
	private int customerId;

	@Column(name = "CUSTOMER_TYPE")
	private String customerType;

	private String instruction;

	@Column(name = "PAYMENT_NO")
	private String paymentNo;

	@Column(name = "PAYMENT_TYPE")
	private String paymentType;

	private String purpose;

	@Temporal(TemporalType.DATE)
	@Column(name = "REQ_DATE")
	private Date reqDate;

	@Column(name = "REQ_USER_ID")
	private int reqUserId;

	private byte status;

	// bi-directional many-to-one association to Fund
	@ManyToOne
	private Fund fund;

	public Payment() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public BigDecimal getAmount() {
		return this.amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public String getBankAccount() {
		return this.bankAccount;
	}

	public void setBankAccount(String bankAccount) {
		this.bankAccount = bankAccount;
	}

	public String getBankName() {
		return this.bankName;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	public Date getChequeDate() {
		return this.chequeDate;
	}

	public void setChequeDate(Date chequeDate) {
		this.chequeDate = chequeDate;
	}

	public String getChequeNo() {
		return this.chequeNo;
	}

	public void setChequeNo(String chequeNo) {
		this.chequeNo = chequeNo;
	}

	public Date getConfDate() {
		return this.confDate;
	}

	public void setConfDate(Date confDate) {
		this.confDate = confDate;
	}

	public int getConfUserId() {
		return this.confUserId;
	}

	public void setConfUserId(int confUserId) {
		this.confUserId = confUserId;
	}

	public int getCustomerId() {
		return this.customerId;
	}

	public void setCustomerId(int customerId) {
		this.customerId = customerId;
	}

	public String getCustomerType() {
		return this.customerType;
	}

	public void setCustomerType(String customerType) {
		this.customerType = customerType;
	}

	public String getInstruction() {
		return this.instruction;
	}

	public void setInstruction(String instruction) {
		this.instruction = instruction;
	}

	public String getPaymentNo() {
		return this.paymentNo;
	}

	public void setPaymentNo(String paymentNo) {
		this.paymentNo = paymentNo;
	}

	public String getPaymentType() {
		return this.paymentType;
	}

	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}

	public String getPurpose() {
		return this.purpose;
	}

	public void setPurpose(String purpose) {
		this.purpose = purpose;
	}

	public Date getReqDate() {
		return this.reqDate;
	}

	public void setReqDate(Date reqDate) {
		this.reqDate = reqDate;
	}

	public int getReqUserId() {
		return this.reqUserId;
	}

	public void setReqUserId(int reqUserId) {
		this.reqUserId = reqUserId;
	}

	public byte getStatus() {
		return this.status;
	}

	public void setStatus(byte status) {
		this.status = status;
	}

	public Fund getFund() {
		return this.fund;
	}

	public void setFund(Fund fund) {
		this.fund = fund;
	}

	@Transient
	@Override
	public Long getLogId() {
		return ValueConvert.toLong(this.id);
	}

	@Transient
	@Override
	public String getLogDeatil() {
		StringBuilder sb = new StringBuilder();
		sb.append("Payment Id : ").append(id).append("Payment Code").append(paymentNo).append("Status").append(status);

		return sb.toString();
	}

}